#ifndef SHELLSORT_H
#define SHELLSORT_H

#include "sortbase.h"
#include <QEventLoop>
#include <QVariantAnimation>

class ShellSort : public SortBase
{
    Q_OBJECT
public:
    explicit ShellSort(QObject *parent = nullptr);

    void sort(size_t num_of_elem, int interval) override;
    void stop() override;
    void draw(QPainter *painter, int width, int height) override;
    void skip() override;

    void wait(int ms);

private:
    QEventLoop loop;
    QVariantAnimation animation;
    int interval{1};

    int curr_i{0}, curr_j{0}, sep_gap{0};
    bool swapFlag{false};
};

#endif // SHELLSORT_H
